package org.example.arraylist01;

import java.util.ArrayList;

/**
 * ArrayList存储自定义引用类型
 */
public class ArrayListDemo06 {
    public static void main(String[] args) {
        ArrayList<Person> people = new ArrayList<>();
        Person p1 = new Person("李逍遥", 18);
        Person p2 = new Person("赵灵儿", 17);
        Person p3 = new Person("林月如", 19);
        people.add(p1);
        people.add(p2);
        people.add(p3);
        System.out.println(people);


        for (Person p : people) {
            System.out.println(p.getAge()+p.getName());
        }
    }
}

